package com.aqiang.day0528_shop.user.presenter

import com.aqiang.day0528_shop.user.contract.UserContract
import com.aqiang.day0528_shop.user.model.RegisterModel

class RegisterPresenter(var v:UserContract.RegisterView) : UserContract.RegisterPresenter(v) {
    override fun register() {
        if (mView.get() != null && mView != null){
            val responseEntity = mModel.register(mView.get()!!.getUser(), mView.get()!!.getPwd())
            mView.get()!!.success(responseEntity)
        }
    }

    override fun auth() {
        if (mView.get() != null && mView != null){
            val auth = mModel.auth()
            mView.get()!!.successAuth(auth)
        }
    }

    override fun initModel(): UserContract.RegisterModel {
        return RegisterModel()
    }
}